/**
 * @author LKQ
 * @date 2022/1/4 15:58
 * @description 滚动数组，维护固定的两个数
 */
public class FormalSolution {
    public static void main(String[] args) {

    }
    public int fib(int n) {
        if (n < 2) {
            return n;
        }
        // 滚动数组
        int p = 0, q = 0, r = 1;
        for (int i = 2; i <= n; ++i) {
            p = q;
            q = r;
            r = p + q;
        }
        return r;
    }

}
